package com.scalar.chiptrack.sales.forms;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.sales.SalesOrder;
import com.scalar.chiptrack.utils.StringUtils;

/**
 * Form bean for the customer_setup page.  This form has the following fields,
 * with default values in square brackets:
 * <ul>
 * <li><b>action</b> - The maintenance action we are performing (Create. Modify & Save).
 * </ul>
 *
 * @author Kesava Kumar Achanala
 * @version $Revision: 1.3 $ $Date: 2008/06/17 14:50:15 $
 */




public final class ApproverOrderForm extends ChipTrackActionForm  {


    // --------------------------------------------------- Instance Variables


	private String action = null;

	private SalesOrder salesOrder = new SalesOrder();

        private boolean financeHold = false;
        private String financeHoldUser = null;
        private boolean operationsHold = false;
        private String operationsHoldUser = null;
        private boolean marketingHold = false;
        private String marketingHoldUser = null;
        private boolean salesHold = false;
        private String salesHoldUser = null;
        private int salesOrderId = -1;
        private String comments = null;
		private String salesOrderNo = null;


    // ----------------------------------------------------------- Properties



    /**
     * Get SalesOrder
     *
     * @return SalesOrder
     */
    public SalesOrder getSalesOrder()
    {
	return salesOrder;
    }

    /**
     * Set the SalesOrder
     *
     * @param SalesOrder
     */
    public void setSalesOrder(SalesOrder salesOrder)
    {
 	this.salesOrder = salesOrder;
    }

   /**
    * Get action
    *
    * @return action
    */
   public String getAction()
   {
	   return action;
   }

   /**
    * Set the action
    *
    * @param action
    */
   public void setAction(String action)
   {
 	this.action = action;
   }

   public int getSalesOrderId()
   {
       return salesOrderId;
   }

   public void setSalesOrderId(int salesOrderId)
   {
       this.salesOrderId = salesOrderId;
   }

   public boolean getFinanceHold()
   {
       return financeHold;
   }

   public void setFinanceHold(boolean financeHold)
   {
       this.financeHold = financeHold;
   }

   public boolean getOperationsHold()
   {
       return operationsHold;
   }

   public void setOperationsHold(boolean operationsHold)
   {
       this.operationsHold = operationsHold;
   }

   public boolean getMarketingHold()
   {
       return marketingHold;
   }

   public void setMarketingHold(boolean marketingHold)
   {
       this.marketingHold = marketingHold;
   }

   public boolean getSalesHold()
   {
       return salesHold;
   }

   public void setSalesHold(boolean salesHold)
   {
       this.salesHold = salesHold;
   }

   public String getFinanceHoldUser()
   {
       return financeHoldUser;
   }

   public void setFinanceHoldUser(String financeHoldUser)
   {
       this.financeHoldUser = financeHoldUser;
   }

   public String getOperationsHoldUser()
   {
       return operationsHoldUser;
   }

   public void setOperationsHoldUser(String operationsHoldUser)
   {
       this.operationsHoldUser = operationsHoldUser;
   }

   public String getMarketingHoldUser()
   {
       return marketingHoldUser;
   }

   public void setMarketingHoldUser(String marketingHoldUser)
   {
       this.marketingHoldUser = marketingHoldUser;
   }

   public String getSalesHoldUser()
   {
       return salesHoldUser;
   }

   public void setSalesHoldUser(String salesHoldUser)
   {
       this.salesHoldUser = salesHoldUser;
   }

   public String getApproverComments()
   {
       return comments;
   }

   public void setApproverComments(String comments)
   {
       this.comments = comments;
   }

   private String[] lineItemNo;
   private String[] scheduleDate;
   private String[] revisedDate;
   public String[] getLineItemNo()
   {
       return lineItemNo;
   }

   public void setLineItemNo(String[] lineItemNo)
   {
       this.lineItemNo = lineItemNo;
   }

   public String[] getScheduleDate()
   {
       return scheduleDate;
   }

   public void setScheduleDate(String[] scheduleDate)
   {
       this.scheduleDate = scheduleDate;
   }

   public String[] getRevisedDate()
   {
       return revisedDate;
   }

   public void setRevisedDate(String[] revisedDate)
   {
       this.revisedDate = revisedDate;
   }

       private static int totalQty;
    private static float totalAmount;
    public String getTotalQty()
    {
        return StringUtils.formatUnits(totalQty);
    }
    public void setTotalQty(int totalQty)
    {
        this.totalQty = totalQty;
    }
    public String getTotalAmount()
    {
        return StringUtils.formatAmountWithNoOfDecimals(totalAmount);
    }
    public void setTotalAmount(float totalAmount)
    {
        this.totalAmount = totalAmount;
    }
	public String getSalesOrderNo()
    {
        return salesOrderNo;
    }
    public void setSalesOrderNo(String salesOrderNo)
    {
        this.salesOrderNo = salesOrderNo;
    }


    // --------------------------------------------------------- Public Methods


    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {



    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();

        //if ((vendorName == null) || (vendorName.length() < 1))
        //    errors.add("Vendor", new ActionError("error.vendor name.required"));

        return errors;

    }


}
